import java.util.Scanner;

public class Main {
    public int removeDuplicates(int[] nums) {
        if (nums.length == 0) {
            return 0;
        }
        int i = 1, j = 1;
        while (i < nums.length) {
            if (nums[i - 1] != nums[i]) {
                nums[j++] = nums[i++];
            } else {
                i++;
            }
        }
        return j;
    }
}
